'use strict';

const Controller = require('egg').Controller;

class HomeController extends Controller {
  async index() {
    const { ctx } = this;
    ctx.body = 'hi, egg';
  }

  async login(){
    const {ctx,app}=this
    const {user_name,user_pwd}=ctx.request.body

    if(user_name&&user_pwd){
        // 生成token
        const userInfo={
            name:"lufei",
            role:"超级管理员",
            login_time:Date.now(),
            end_time:Date.now()+3600*2
        }
        const token=app.jwt.sign(userInfo,app.config.jwt.sercet)
        
    }
}
}

